
package com.jf.cloud.supplier.listener;

import com.jf.cloud.common.rocketmq.config.RocketMqConstant;
import com.jf.cloud.supplier.service.SupplierWalletService;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author zz
 */
@Component
@RocketMQMessageListener(topic = RocketMqConstant.ORDER_SETTLED_SUPPLIER_TOPIC,consumerGroup = RocketMqConstant.ORDER_SETTLED_SUPPLIER_TOPIC)
public class OrderReceiptSupplierConsumer implements RocketMQListener<Long> {

    @Autowired
    private SupplierWalletService supplierWalletService;

    /**
     * 结束周期完成，结算给商家
     */
    @Override
    public void onMessage(Long orderId) {
        supplierWalletService.addAmountBySettledOrder(orderId);
    }
}
